package com.qf.controller;

import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author ShenZhuoPing
 * @version V1.0
 * @Project TestSSM
 * @Package com.qf.controller
 * @Description:
 * @Date 2022/7/16 15:46
 */
@Controller
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping
    public String findPage(Model model,
                           @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
                           @RequestParam(name = "pageSize",defaultValue = "4                                                                                                                                                                                           ") Integer pageSize){
        Object page = userService.findPage(pageNum, pageSize);
        Model data = model.addAttribute("data", page);
        return "/userpro.jsp";
    }
}
